<script setup>
import { useRoute, useRouter } from 'vue-router';

// this.$router.push()
// route 获取当前路由的对象， router 拿的整个路由实例
const router = useRouter()
const route = useRoute()
console.log('route', route);
const goHome = () => {
    router.push('/')
}
</script>

<template>
    <h1>Hello vue3</h1>
    <ul>
        <li>
            <RouterLink to="/">首页</RouterLink>
        </li>
        <li>
            <RouterLink to="/login">登录页</RouterLink>
        </li>
    </ul>
    <button @click="goHome">去首页</button>
    <!-- 路由出口 -->
    <RouterView></RouterView>
</template>
